<%--
    Document   : index
    Created on : Dec 9, 2011, 8:47:24 AM
    Author     : HuyNVK
--%>

<%@page import="javax.servlet.*" %>
<%@page import="util.Constants" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="css/Style.css" rel="stylesheet" type="text/css"/>
        <link href="css/admin.css" rel="stylesheet" type="text/css"/>
        <script src="js/functions.js" type="text/javascript"></script>
    </head>
    <body>
        <%
        String admin = (String) session.getAttribute("admin");
        if(admin==null || admin.isEmpty()) admin = "";
        String user = (String) session.getAttribute("user");
        if(user==null || user.isEmpty()) user = "";
        %>
        <form name="frmIndex" action="Controller" method="post">
            <input type="hidden" name="pageName" value=""/>
            <input type="hidden" name="subPage" value=""/>
            <input type="hidden" name="section" value=""/>
            <input type="hidden" name="action" value=""/>
            <input type="hidden" name="admin" value="<%=admin%>"/>
            <input type="hidden" name="user" value="<%=user%>"/>

            <div class="container">
                <div id="header">
                    <!--<a onclick="redirect(frmIndex,'<%=Constants.PROFILE_PAGE_NAME%>')">PROFILE</a>-->
                    <a onclick="redirect(frmIndex,'<%=Constants.DEFECT_LOG_PAGE_NAME%>',
                        '<%=Constants.DEFECTLOG_STATISTIC%>')">DEFECT LOGS</a>
                    <!--<a onclick="redirect(frmIndex,'<%=Constants.TEAMMATE_PAGE_NAME%>')">TEAMMATES</a>-->
                    <a onclick="redirect(frmIndex,'<%=Constants.ADMIN_PAGE_NAME%>')">ADMIN</a>
                    <a onclick="redirect(frmIndex,'<%=Constants.HOME_PAGE_NAME%>')">HOME PAGE</a>
                </div>
                <div id="web-body">
                    <%
                    Object pageName = session.getAttribute("pageName");
                    Object subPage = session.getAttribute("subPage");
                    %>
                    <div id="page-title">
                        <%
                        if(pageName == null)
                            out.print(Constants.HOME_PAGE_NAME);
                        else
                            out.print(pageName);
                        if(subPage != null && subPage.toString() != "undefined")
                            out.print(" / " + subPage.toString());
                        %>
                    </div>
                    <%
                    //Select which page to show                    
                    if (pageName == null || pageName.toString().equalsIgnoreCase(Constants.HOME_PAGE_NAME)) {
                        %>
                        <!-- Show Home Page -->
                        <%@include file="homepage.jsp"%>
                        <%
                    } else if (pageName.toString().equalsIgnoreCase(Constants.DEFECT_LOG_PAGE_NAME)) {
                        %>
                        <!-- Show Defect Log Page -->
                        <%@include file="defectlog/index.jsp"%>
                        <%
                    } else if (pageName.toString().equalsIgnoreCase(Constants.PROFILE_PAGE_NAME)) {
                        %>
                        <!-- Show Defect Log Page -->
                        <%@include file="profile/edit.jsp"%>
                        <%
                    } else if (pageName.toString().equalsIgnoreCase(Constants.TEAMMATE_PAGE_NAME)) {
                        %>
                        <!-- Show Teammate Page -->
                        <%@include file="teammate.jsp"%>
                        <%
                    } else if (pageName.toString().equalsIgnoreCase(Constants.ADMIN_PAGE_NAME)) {
                        %>
                        <!-- Show Log In Page -->
                        <%@include file="admin/index.jsp"%>
                        <%
                    } else if (pageName.toString().equalsIgnoreCase(Constants.LOGIN_USER_PAGE_NAME)) {
                        %>
                        <!-- Show Log In Page -->
                        <%@include file="Login/user.jsp"%>
                        <%
                    }
                    %>
                </div>
                <div id="footer">
			Released Year: 2011<br>
			Copyright: UIT CNPM03 Group.
                </div>
            </div>
        </form>
    </body>
</html>
